home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 972 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.0 KB

  1. From: rmcinnis@gate.net (Robert B McInnis)
  2. Message-ID: <4k0mcd$1iog@news.gate.net>
  3. X-Original-Date: 4 Apr 1996 14:29:33 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 05 Apr 96 03:42:28 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Return-Path: <daemon@meeker.UCAR.EDU>
  8. Newsgroups: comp.std.c++
  9. Subject: Additions to the STL : Callback/Observer pair
  10. Organization: 9th Bit Software
  11. X-Newsreader: News Xpress Version 1.0 Beta #4
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMWSWtOEDnX0m9pzZAQHCHwF/Q3F3vXFgd9BxEHGs9GZEsX4voTOoC0TL
  14.     mhL80apD8XFIgwESHbNMYgewmmZZCIh5
  15.     =p6aE
  16.  
  17. I would like to propose a Callback/Observer construct for the Standard
  18. Template Library.  This could be a base class pair with the Observer
  19. being primarily templates.  This would allow for a consistent
  20. Callback/Observer pattern to be used across applications.  This would
  21. also familiarize people with the pattern and promote different design
  22. decisions when designing an app.
  23.  
  24. The Callback class should be a simple list of Observers that the owner, or 
  25. possibly anyone, depending on access, would be able to invoke or disable.
  26.  
  27. An Observer should be dynamic enough so that if the receiver instance,
  28. that is attached directly to the Observer instance, were to be deleted,
  29. then the Observer object would know to just disable its node on its
  30. associated Callback list.
  31.  
  32. This would lead to the concept of Observible destruction of objects.
  33.  
  34. What about observible construction on a class.  This would allow my class to 
  35. know when an instance of itself has been created, then fire off an initialize 
  36. VIRTUAL, since this really can't be done in the constructor without EVERY 
  37. descendent having to know about the initialize method.
  38.  
  39. This would eventually allow for observible files on a file system.  Imagine 
  40. that!  Biff would be a trivial app (even on DOS) without a polling mechanism.
  41. Or maybe just for version control, to know when certain files have updated on
  42. a LARGE network based development effort.
  43.  
  44. Just a thought.  If anyone is actually listening, it'd be nice to know what's 
  45. thought of this.  Need an example of a callback/observer pair?  Just eMail me.
  46.  
  47. Thanks for the time,
  48.  
  49. Rob
  50.  
  51. ---------------------------
  52. Robert McInnis
  53. 9th Bit Software
  54. (eMail)  rmcinnis@gate.net
  55. (web  )  http://www.gate.net/~rmcinnis
  56. ---
  57. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  58. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  59. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  60. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  61. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  62. ---
  63. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  64. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  65. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  66. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  67. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  68.